public class test2 {
    public static void main(String[] args){
        int sum = 0;

        for (int i = 1; i <= 5; i++) {
             int tmp = 1;
              for (int j = 1; j <= i; j++) {
            tmp *= j;
     }
                 sum += tmp;
        }

        System.out.println("sum = " + sum);

    }
}
